xsplice: Implement payload loading
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 27 Apr 2016 13:01:51 +0000 (09:01 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 29 Apr 2016 07:58:23 +0000 (03:58 -0400)
commit380b229634f8e27c1abca05e2a8a54b08ca914c5
treea2ea54545ed3f5fd3f28e3592cb40da505157f27
parent18adaa9da02d7014a7760e15d213f45e23df556f
xsplice: Implement payload loading

Add support for loading xsplice payloads. This is somewhat similar to
the Linux kernel module loader, implementing the following steps:
- Verify the elf file.
- Parse the elf file.
- Allocate a region of memory mapped within a free area of
  [xen_virt_end, XEN_VIRT_END].
- Copy allocated sections into the new region. Split them in three
  regions - .text, .data, and .rodata. MUST have at least .text.
- Resolve section symbols. All other symbols must be absolute addresses.
  (Note that patch titled "xsplice,symbols: Implement symbol name resolution
   on address" implements that)
- Perform relocations.
- Secure the the regions (.text,.data,.rodata) with proper permissions.

We capitalize on the vmalloc callback API (see patch titled:
"rm/x86/vmap: Add v[z|m]alloc_xen, and vm_init_type") to allocate
a region of memory within the [xen_virt_end, XEN_VIRT_END] for the code.

We also use the "x86/mm: Introduce modify_xen_mappings()"
to change the virtual address page-table permissions.

Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/arm/Makefile
xen/arch/arm/xsplice.c [new file with mode: 0644]
xen/arch/x86/Makefile
xen/arch/x86/xsplice.c [new file with mode: 0644]
xen/common/xsplice.c
xen/common/xsplice_elf.c
xen/include/xen/elfstructs.h
xen/include/xen/xsplice.h
xen/include/xen/xsplice_elf.h